#include "linklist.h"
#include <iostream>
#include <string>
using namespace std;

bool BracketCheck(const string str)
{
	int len=str.length();
    Stack<char> s;
	char temp;
	for (int i=0;i<len;i++)
	{
		switch(str[i])
		{
		case  '(':
		case  '[':
		case  '{':
			s.Push(str[i]);
		case  ')':
		case ']':
		case '}':
			if (!(temp=s.pop()))
			{
				return false;
			}
			if (str[i]=='('&&temp!=')'||str[i]=='['&&temp!=']'||str[i]=='{'&&temp!='}')
			{
				return false;
			}
			break;
		default:
			break;
		}
	}
	if (s.isEmpty())
	{
		return true;
	}
	else
	{
		return false;
	}
}


int main()
{
	const string s("{fsdf(fsdefs[fsdfsd]fsdfsdf(fsdfsdfsd)dscfs)fsdf}");
	cout<<BracketCheck(s);
}